package com.softa.web.controller.custom;

import com.softa.annotation.CurrentUser;
import com.softa.dao.dto.OrderDTO;
import com.softa.dao.model.SysUser;
import com.softa.service.business.OrderService;
import com.softa.vo.QueryRequest;
import com.softa.web.controller.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 *  订单信息
 * Created by yangl on 2017/8/18.
 */
@Controller
@RequestMapping("/custom/order")
public class CustomOrderController extends BaseController {

    @Autowired
    private OrderService orderService;

    @RequestMapping(value="/data/list",method = RequestMethod.POST)
    @ResponseBody
    public List<OrderDTO> listPage(@CurrentUser SysUser sysUser) {
        QueryRequest queryRequest = new QueryRequest();
        queryRequest.getParams().put("userId", sysUser.getId());
        queryRequest.getParams().put("type", "0");
        return orderService.queryOrdersByParam(queryRequest);
    }
}
